import { defineComponent } from "vue";
import { IFormInput } from "./types";
export default defineComponent({
  name: "input-view",
  props: {
    modelValue: {
      type: String,
      default: "",
    },
    item: {
      type: Object as () => IFormInput,
      default: () => {
        return {};
      },
    },
  },
  emits: ["change"],
  setup(props, { emit }) {
    return () => {
      return (
        <input
          {...(props.item.props as any)}
          class={
            "outline-none border-none text-[12px] placeholder:text-[12px] text-[#666666]"
          }
          onInput={(value: any) => {
            const target = value.target as HTMLInputElement;
            emit("change", target.value);
          }}
          readonly={props.item.readonly}
          placeholder={props.item.placeholder || "请输入"}
          value={props.modelValue}
        />
      );
    };
  },
});
